import jwt from 'jsonwebtoken'

const {JWT_SECRET, JWT_EXPIRES_IN} = process.env

export function createToken(data: any, expiresIn = JWT_EXPIRES_IN) {
  return jwt.sign(data, JWT_SECRET, { expiresIn })
}

export function verifyToken(token: string) {
  return jwt.verify(token, JWT_SECRET)
}
